package com.ly.algorithm.DataStructures.sort;

import java.util.Date;
import java.util.Random;

/**
 * @Classname InsertSort
 * @Description TODO
 * @Date 2020/4/24 11:31
 * @Author 冷心影翼
 */
public class InsertSort {

    public static void main(String[] args) {
//        int[] arr = {55,202,-21,23,34,34,56,7,13,23,77};

        int[] arr = new int[80000];

        Random random = new Random();
        for(int i=0;i<80000;i++) {
            arr[i] =  random.nextInt(80000);
        }

        Date date3 = new Date();

        Date date1 = new Date();

        for(int i=1;i<arr.length;i++) {
            for (int j = i; j > 0; j--) {
                if(arr[j]<arr[j-1]) {
                    int temp = arr[j];
                    arr[j] = arr[j-1];
                    arr[j-1] = temp;
                }else {
                    break;
                }
            }
        }

        Date date2 = new Date();
        System.out.println(date2.getTime()-date1.getTime());
        System.out.println(date1);
        System.out.println(date2);
        System.out.println(date3);
//        System.out.println(Arrays.toString(arr));
    }
}
